<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>ShipCAD: ShipCADlib/utility.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">ShipCAD
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_f0b6ef187c5b1483641b038f81654ac4.html">ShipCADlib</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">utility.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="utility_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/*##############################################################################################</span></div><div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"> *    ShipCAD                                                                                  *</span></div><div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"> *    Copyright 2015, by Greg Green &lt;ggreen@bit-builder.com&gt;                                   *</span></div><div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> *    Original Copyright header below                                                          *</span></div><div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> *                                                                                             *</span></div><div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment"> *    This code is distributed as part of the FREE!ship project. FREE!ship is an               *</span></div><div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment"> *    open source surface-modelling program based on subdivision surfaces and intended for     *</span></div><div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment"> *    designing ships.                                                                         *</span></div><div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment"> *                                                                                             *</span></div><div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment"> *    Copyright © 2005, by Martijn van Engeland                                                *</span></div><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="comment"> *    e-mail                  : Info@FREEship.org                                              *</span></div><div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="comment"> *    FREE!ship project page  : https://sourceforge.net/projects/freeship                      *</span></div><div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="comment"> *    FREE!ship homepage      : www.FREEship.org                                               *</span></div><div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="comment"> *                                                                                             *</span></div><div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="comment"> *    This program is free software; you can redistribute it and/or modify it under            *</span></div><div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="comment"> *    the terms of the GNU General Public License as published by the                          *</span></div><div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="comment"> *    Free Software Foundation; either version 2 of the License, or (at your option)           *</span></div><div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="comment"> *    any later version.                                                                       *</span></div><div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="comment"> *                                                                                             *</span></div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="comment"> *    This program is distributed in the hope that it will be useful, but WITHOUT ANY          *</span></div><div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="comment"> *    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A          *</span></div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="comment"> *    PARTICULAR PURPOSE. See the GNU General Public License for more details.                 *</span></div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="comment"> *                                                                                             *</span></div><div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="comment"> *    You should have received a copy of the GNU General Public License along with             *</span></div><div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="comment"> *    this program; if not, write to the Free Software Foundation, Inc.,                       *</span></div><div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;<span class="comment"> *    59 Temple Place, Suite 330, Boston, MA 02111-1307 USA                                    *</span></div><div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;<span class="comment"> *                                                                                             *</span></div><div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="comment"> *#############################################################################################*/</span></div><div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;</div><div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;<span class="preprocessor">#ifndef UTILITY_H_</span></div><div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;<span class="preprocessor">#define UTILITY_H_</span></div><div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;</div><div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;<span class="preprocessor">#include &lt;vector&gt;</span></div><div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;<span class="preprocessor">#include &lt;QVector3D&gt;</span></div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;<span class="preprocessor">#include &lt;QColor&gt;</span></div><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;<span class="preprocessor">#include &lt;QString&gt;</span></div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="spline_8h.html">spline.h</a>&quot;</span></div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="plane_8h.html">plane.h</a>&quot;</span></div><div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="projsettings_8h.html">projsettings.h</a>&quot;</span></div><div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;</div><div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespaceShipCAD.html">ShipCAD</a> {</div><div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;</div><div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;    <span class="keywordtype">void</span> <a class="code" href="namespaceShipCAD.html#aa5d3fc63603d716d3e24244049e1e510">MinMax</a>(<span class="keyword">const</span> QVector3D&amp; p, QVector3D&amp; min, QVector3D&amp; max);</div><div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;    <span class="keywordtype">float</span> <a class="code" href="namespaceShipCAD.html#a69361fa79b1f818e21306f6266ee45d3">DistancepointToLine</a>(<span class="keyword">const</span> QVector3D&amp; p, <span class="keyword">const</span> QVector3D&amp; l1, <span class="keyword">const</span> QVector3D&amp; l2);</div><div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;</div><div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;    QVector3D <a class="code" href="namespaceShipCAD.html#a83f7c2b40959a0d02a2cc1085b0d07ee">Interpolate</a>(<span class="keyword">const</span> QVector3D&amp; p1, <span class="keyword">const</span> QVector3D&amp; p2, <span class="keywordtype">float</span> param);</div><div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;</div><div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;    QVector3D <a class="code" href="namespaceShipCAD.html#ad1ad66c896fe763fb4603989ff1f1182">MidPoint</a>(<span class="keyword">const</span> QVector3D&amp; p1, <span class="keyword">const</span> QVector3D&amp; p2);</div><div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;</div><div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;    QVector3D <a class="code" href="namespaceShipCAD.html#a30b09a2ad6cc05c2ce1cdc450a0857d1">PointProjectToLine</a>(<span class="keyword">const</span> QVector3D&amp; p1, <span class="keyword">const</span> QVector3D&amp; p2, <span class="keyword">const</span> QVector3D&amp; p);</div><div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;</div><div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;    <span class="keywordtype">int</span> <a class="code" href="namespaceShipCAD.html#a87efc267ae07a84fb1cd55a4562c2907">FindDXFColorIndex</a>(QColor color);</div><div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;</div><div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;    QColor <a class="code" href="namespaceShipCAD.html#a9956eca83968462fc4c48c376a10d577">QColorFromDXFIndex</a>(<span class="keywordtype">int</span> index);</div><div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;</div><div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;    QColor <a class="code" href="namespaceShipCAD.html#acb142056788b7a6e18e908c5b2fd8d52">FillColor</a>(<span class="keywordtype">float</span> parameter);</div><div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;</div><div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;    <span class="comment">// calculate the normal of a plane defined by points p1,p2,p3 and scale to unit-length</span></div><div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;<span class="comment"></span>    QVector3D <a class="code" href="namespaceShipCAD.html#a81e47e31f89000550b007c0f9a4d09aa">UnifiedNormal</a>(<span class="keyword">const</span> QVector3D&amp; p1, <span class="keyword">const</span> QVector3D&amp; p2, <span class="keyword">const</span> QVector3D&amp; p3);</div><div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;</div><div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;    <span class="keywordtype">float</span> <a class="code" href="namespaceShipCAD.html#ac344c080c66b4394cb988cf88c726029">DegToRad</a>(<span class="keywordtype">float</span> deg);</div><div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;</div><div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;    <span class="keywordtype">float</span> <a class="code" href="namespaceShipCAD.html#a3ad1916db38fb61e8a053f944df49cee">RadToDeg</a>(<span class="keywordtype">float</span> rad);</div><div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;</div><div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="namespaceShipCAD.html#ae1773f0e415446342401a67430a8b643">PointInTriangle</a>(<span class="keyword">const</span> QVector3D&amp; intercept,</div><div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;                                    <span class="keyword">const</span> QVector3D&amp; p0,</div><div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;                                    <span class="keyword">const</span> QVector3D&amp; p1,</div><div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;                                    <span class="keyword">const</span> QVector3D&amp; p2);</div><div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;</div><div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;    <span class="keywordtype">void</span> <a class="code" href="namespaceShipCAD.html#a36b9b33181823761bc327d66c36c8d8f">ClipTriangle</a>(<span class="keyword">const</span> QVector3D&amp; p1,</div><div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;                      <span class="keyword">const</span> QVector3D&amp; p2,</div><div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;                      <span class="keyword">const</span> QVector3D&amp; p3,</div><div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;                     <span class="keywordtype">float</span> s1,</div><div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;                     <span class="keywordtype">float</span> s2,</div><div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;                     <span class="keywordtype">float</span> s3,</div><div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;                     std::vector&lt;QVector3D&gt;&amp; front,</div><div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;                     std::vector&lt;QVector3D&gt;&amp; back);</div><div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;</div><div class="line"><a name="l00186"></a><span class="lineno">  186</span>&#160;    <span class="keywordtype">void</span> <a class="code" href="namespaceShipCAD.html#a36b9b33181823761bc327d66c36c8d8f">ClipTriangle</a>(<span class="keyword">const</span> QVector3D&amp; p1,</div><div class="line"><a name="l00187"></a><span class="lineno">  187</span>&#160;                             <span class="keyword">const</span> QVector3D&amp; p2,</div><div class="line"><a name="l00188"></a><span class="lineno">  188</span>&#160;                             <span class="keyword">const</span> QVector3D&amp; p3,</div><div class="line"><a name="l00189"></a><span class="lineno">  189</span>&#160;                             <span class="keyword">const</span> Plane&amp; plane,</div><div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;                             std::vector&lt;QVector3D&gt;&amp; front,</div><div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;                             std::vector&lt;QVector3D&gt;&amp; back);</div><div class="line"><a name="l00192"></a><span class="lineno">  192</span>&#160;</div><div class="line"><a name="l00199"></a><span class="lineno">  199</span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="namespaceShipCAD.html#aec056383a39d900bd079feee8bcca060">Lines3DIntersect</a>(<span class="keyword">const</span> QVector3D&amp; p1, <span class="keyword">const</span> QVector3D&amp; p2, <span class="keyword">const</span> QVector3D&amp; p3,</div><div class="line"><a name="l00200"></a><span class="lineno">  200</span>&#160;                          <span class="keyword">const</span> QVector3D&amp; p4, <span class="keywordtype">double</span>&amp; param, QVector3D&amp; int1);</div><div class="line"><a name="l00201"></a><span class="lineno">  201</span>&#160;    </div><div class="line"><a name="l00208"></a><span class="lineno">  208</span>&#160;    <span class="keywordtype">float</span> <a class="code" href="namespaceShipCAD.html#a6f9f5ac15e7e2821bba27ba06827a4e1">SquaredDistPP</a>(<span class="keyword">const</span> QVector3D&amp; p1, <span class="keyword">const</span> QVector3D&amp; p2);</div><div class="line"><a name="l00209"></a><span class="lineno">  209</span>&#160;</div><div class="line"><a name="l00216"></a><span class="lineno">  216</span>&#160;    <span class="keywordtype">float</span> <a class="code" href="namespaceShipCAD.html#a438e97b711c6878eba3bf7182e68a3c7">DistPP3D</a>(<span class="keyword">const</span> QVector3D&amp; p1, <span class="keyword">const</span> QVector3D&amp; p2);</div><div class="line"><a name="l00217"></a><span class="lineno">  217</span>&#160;</div><div class="line"><a name="l00223"></a><span class="lineno">  223</span>&#160;    QString <a class="code" href="namespaceShipCAD.html#a45ba7de6922e89cbddf2a4c9c810a2e4">BoolToStr</a>(<span class="keywordtype">bool</span> val);</div><div class="line"><a name="l00224"></a><span class="lineno">  224</span>&#160;</div><div class="line"><a name="l00232"></a><span class="lineno">  232</span>&#160;    <span class="keywordtype">void</span> <a class="code" href="namespaceShipCAD.html#a2eddf75f0e29363ab81a3fb0e0211848">JoinSplineSegments</a>(<span class="keywordtype">float</span> join_error, <span class="keywordtype">bool</span> force_to_one_segment,</div><div class="line"><a name="l00233"></a><span class="lineno">  233</span>&#160;                                   <a class="code" href="namespaceShipCAD.html#a053b941b2c87049bb9380428d4d5a056">SplineVector</a>&amp; list);</div><div class="line"><a name="l00234"></a><span class="lineno">  234</span>&#160;</div><div class="line"><a name="l00242"></a><span class="lineno">  242</span>&#160;    <span class="keywordtype">int</span> <a class="code" href="namespaceShipCAD.html#a70b238d926183460670b82d9680b5cb9">ReadIntFromStr</a>(<span class="keywordtype">size_t</span> lineno, <span class="keyword">const</span> QString&amp; str, <span class="keywordtype">size_t</span>&amp; start);</div><div class="line"><a name="l00243"></a><span class="lineno">  243</span>&#160;</div><div class="line"><a name="l00251"></a><span class="lineno">  251</span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="namespaceShipCAD.html#af343b5a2dfd09b32b9451d35e0676384">ReadBoolFromStr</a>(<span class="keywordtype">size_t</span> lineno, <span class="keyword">const</span> QString&amp; str, <span class="keywordtype">size_t</span>&amp; start);</div><div class="line"><a name="l00252"></a><span class="lineno">  252</span>&#160;</div><div class="line"><a name="l00260"></a><span class="lineno">  260</span>&#160;    <span class="keywordtype">float</span> <a class="code" href="namespaceShipCAD.html#a696bc38864a736dda734802f3cda4346">ReadFloatFromStr</a>(<span class="keywordtype">size_t</span> lineno, <span class="keyword">const</span> QString&amp; str, <span class="keywordtype">size_t</span>&amp; start);</div><div class="line"><a name="l00261"></a><span class="lineno">  261</span>&#160;</div><div class="line"><a name="l00268"></a><span class="lineno">  268</span>&#160;    <span class="keywordtype">float</span> <a class="code" href="namespaceShipCAD.html#a44025ef38e6ee9f12cbf032660f637b5">FindWaterViscosity</a>(<span class="keywordtype">float</span> density, <a class="code" href="namespaceShipCAD.html#ac6a7a28b4b063771afae92decb602da5">unit_type_t</a> units);</div><div class="line"><a name="l00269"></a><span class="lineno">  269</span>&#160;</div><div class="line"><a name="l00280"></a><span class="lineno">  280</span>&#160;    QString <a class="code" href="namespaceShipCAD.html#ae416df4a72579eb3a1a418b19551eb53">ChangeFileExt</a>(<span class="keyword">const</span> QString&amp; name, <span class="keyword">const</span> QString&amp; ext);</div><div class="line"><a name="l00281"></a><span class="lineno">  281</span>&#160;</div><div class="line"><a name="l00290"></a><span class="lineno">  290</span>&#160;    <span class="keywordtype">float</span> <a class="code" href="namespaceShipCAD.html#ad3ca198e79658bf065f1c1c416f23670">VolumeToDisplacement</a>(<span class="keywordtype">float</span> volume, <span class="keywordtype">float</span> density, <span class="keywordtype">float</span> appcoeff, <a class="code" href="namespaceShipCAD.html#ac6a7a28b4b063771afae92decb602da5">unit_type_t</a> units);</div><div class="line"><a name="l00291"></a><span class="lineno">  291</span>&#160;</div><div class="line"><a name="l00299"></a><span class="lineno">  299</span>&#160;    QString <a class="code" href="namespaceShipCAD.html#ae378a523725f5718c9f2b55103f08dcb">MakeLength</a>(<span class="keywordtype">float</span> value, <span class="keywordtype">int</span> decimals, <span class="keywordtype">int</span> des_length);</div><div class="line"><a name="l00300"></a><span class="lineno">  300</span>&#160;</div><div class="line"><a name="l00307"></a><span class="lineno">  307</span>&#160;    QString <a class="code" href="namespaceShipCAD.html#ae378a523725f5718c9f2b55103f08dcb">MakeLength</a>(<span class="keyword">const</span> QString&amp; value, <span class="keywordtype">int</span> des_length);</div><div class="line"><a name="l00308"></a><span class="lineno">  308</span>&#160;</div><div class="line"><a name="l00315"></a><span class="lineno">  315</span>&#160;    QString <a class="code" href="namespaceShipCAD.html#a646812cc2b9066dfc47f2ed7e1faa955">Truncate</a>(<span class="keywordtype">float</span> val, <span class="keywordtype">int</span> max_length);</div><div class="line"><a name="l00316"></a><span class="lineno">  316</span>&#160;</div><div class="line"><a name="l00324"></a><span class="lineno">  324</span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="namespaceShipCAD.html#ae1b7d6603b6c5a2969befdbd629f2e8b">FuzzyCompare</a>(<span class="keywordtype">float</span> val1, <span class="keywordtype">float</span> val2, <span class="keywordtype">float</span> error);</div><div class="line"><a name="l00325"></a><span class="lineno">  325</span>&#160;</div><div class="line"><a name="l00331"></a><span class="lineno">  331</span>&#160;    <span class="keywordtype">double</span> <a class="code" href="namespaceShipCAD.html#ad4bf48489d173fd29503cd9b511f52e9">Sign</a>(<span class="keywordtype">double</span> val);</div><div class="line"><a name="l00332"></a><span class="lineno">  332</span>&#160;</div><div class="line"><a name="l00337"></a><span class="lineno">  337</span>&#160;    <span class="keywordtype">size_t</span> <a class="code" href="namespaceShipCAD.html#a26237f4689cbf7e356c7c1ce3f9c69ff">to_size_t</a>(<span class="keywordtype">int</span> val);</div><div class="line"><a name="l00338"></a><span class="lineno">  338</span>&#160;</div><div class="line"><a name="l00343"></a><span class="lineno">  343</span>&#160;    QColor <a class="code" href="namespaceShipCAD.html#a6bc9d2025502c6f4052b89c82c72762c">RandomColor</a>();</div><div class="line"><a name="l00344"></a><span class="lineno">  344</span>&#160;</div><div class="line"><a name="l00356"></a><span class="lineno">  356</span>&#160;    QVector3D <a class="code" href="namespaceShipCAD.html#af88f847dc1803cadbeb655783961dbfd">RotateVector</a>(<span class="keyword">const</span> QVector3D&amp; coord, <span class="keywordtype">double</span> sinx, <span class="keywordtype">double</span> cosx,</div><div class="line"><a name="l00357"></a><span class="lineno">  357</span>&#160;                           <span class="keywordtype">double</span> siny, <span class="keywordtype">double</span> cosy, <span class="keywordtype">double</span> sinz, <span class="keywordtype">double</span> cosz);</div><div class="line"><a name="l00358"></a><span class="lineno">  358</span>&#160;</div><div class="line"><a name="l00365"></a><span class="lineno">  365</span>&#160;    QString <a class="code" href="namespaceShipCAD.html#ac24d97adcdf1709fc8e857f5d07395ff">ConvertDimension</a>(<span class="keywordtype">float</span> value, <a class="code" href="namespaceShipCAD.html#ac6a7a28b4b063771afae92decb602da5">unit_type_t</a> units);</div><div class="line"><a name="l00366"></a><span class="lineno">  366</span>&#160;</div><div class="line"><a name="l00367"></a><span class="lineno">  367</span>&#160;};</div><div class="line"><a name="l00368"></a><span class="lineno">  368</span>&#160;</div><div class="line"><a name="l00369"></a><span class="lineno">  369</span>&#160;<span class="preprocessor">#endif</span></div><div class="ttc" id="namespaceShipCAD_html_a45ba7de6922e89cbddf2a4c9c810a2e4"><div class="ttname"><a href="namespaceShipCAD.html#a45ba7de6922e89cbddf2a4c9c810a2e4">ShipCAD::BoolToStr</a></div><div class="ttdeci">QString BoolToStr(bool val)</div><div class="ttdoc">convert a bool to a string for serialization </div><div class="ttdef"><b>Definition:</b> <a href="utility_8cpp_source.html#l00410">utility.cpp:410</a></div></div>
<div class="ttc" id="namespaceShipCAD_html_ad4bf48489d173fd29503cd9b511f52e9"><div class="ttname"><a href="namespaceShipCAD.html#ad4bf48489d173fd29503cd9b511f52e9">ShipCAD::Sign</a></div><div class="ttdeci">double Sign(double val)</div><div class="ttdoc">get the sign of a floating point number </div><div class="ttdef"><b>Definition:</b> <a href="utility_8cpp_source.html#l00621">utility.cpp:621</a></div></div>
<div class="ttc" id="projsettings_8h_html"><div class="ttname"><a href="projsettings_8h.html">projsettings.h</a></div></div>
<div class="ttc" id="namespaceShipCAD_html_af343b5a2dfd09b32b9451d35e0676384"><div class="ttname"><a href="namespaceShipCAD.html#af343b5a2dfd09b32b9451d35e0676384">ShipCAD::ReadBoolFromStr</a></div><div class="ttdeci">bool ReadBoolFromStr(size_t lineno, const QString &amp;str, size_t &amp;start)</div><div class="ttdoc">convert a string to an boolean value </div><div class="ttdef"><b>Definition:</b> <a href="utility_8cpp_source.html#l00518">utility.cpp:518</a></div></div>
<div class="ttc" id="spline_8h_html"><div class="ttname"><a href="spline_8h.html">spline.h</a></div></div>
<div class="ttc" id="namespaceShipCAD_html_a6bc9d2025502c6f4052b89c82c72762c"><div class="ttname"><a href="namespaceShipCAD.html#a6bc9d2025502c6f4052b89c82c72762c">ShipCAD::RandomColor</a></div><div class="ttdeci">QColor RandomColor()</div><div class="ttdoc">get a random color </div><div class="ttdef"><b>Definition:</b> <a href="utility_8cpp_source.html#l00637">utility.cpp:637</a></div></div>
<div class="ttc" id="namespaceShipCAD_html_a83f7c2b40959a0d02a2cc1085b0d07ee"><div class="ttname"><a href="namespaceShipCAD.html#a83f7c2b40959a0d02a2cc1085b0d07ee">ShipCAD::Interpolate</a></div><div class="ttdeci">QVector3D Interpolate(const QVector3D &amp;p1, const QVector3D &amp;p2, float param)</div><div class="ttdoc">linearly interpolate a point between 2 points </div><div class="ttdef"><b>Definition:</b> <a href="utility_8cpp_source.html#l00057">utility.cpp:57</a></div></div>
<div class="ttc" id="plane_8h_html"><div class="ttname"><a href="plane_8h.html">plane.h</a></div></div>
<div class="ttc" id="namespaceShipCAD_html_a81e47e31f89000550b007c0f9a4d09aa"><div class="ttname"><a href="namespaceShipCAD.html#a81e47e31f89000550b007c0f9a4d09aa">ShipCAD::UnifiedNormal</a></div><div class="ttdeci">QVector3D UnifiedNormal(const QVector3D &amp;p1, const QVector3D &amp;p2, const QVector3D &amp;p3)</div><div class="ttdoc">find the unit normal of a plane defined by 3 points </div><div class="ttdef"><b>Definition:</b> <a href="utility_8cpp_source.html#l00233">utility.cpp:233</a></div></div>
<div class="ttc" id="namespaceShipCAD_html_ac6a7a28b4b063771afae92decb602da5"><div class="ttname"><a href="namespaceShipCAD.html#ac6a7a28b4b063771afae92decb602da5">ShipCAD::unit_type_t</a></div><div class="ttdeci">unit_type_t</div><div class="ttdef"><b>Definition:</b> <a href="shipcadlib_8h_source.html#l00118">shipcadlib.h:118</a></div></div>
<div class="ttc" id="namespaceShipCAD_html_a3ad1916db38fb61e8a053f944df49cee"><div class="ttname"><a href="namespaceShipCAD.html#a3ad1916db38fb61e8a053f944df49cee">ShipCAD::RadToDeg</a></div><div class="ttdeci">float RadToDeg(float rad)</div><div class="ttdoc">convert radians to degrees </div><div class="ttdef"><b>Definition:</b> <a href="utility_8cpp_source.html#l00248">utility.cpp:248</a></div></div>
<div class="ttc" id="namespaceShipCAD_html_a9956eca83968462fc4c48c376a10d577"><div class="ttname"><a href="namespaceShipCAD.html#a9956eca83968462fc4c48c376a10d577">ShipCAD::QColorFromDXFIndex</a></div><div class="ttdeci">QColor QColorFromDXFIndex(int index)</div><div class="ttdoc">get a QColor from a DXF color index </div><div class="ttdef"><b>Definition:</b> <a href="utility_8cpp_source.html#l00153">utility.cpp:153</a></div></div>
<div class="ttc" id="namespaceShipCAD_html_a30b09a2ad6cc05c2ce1cdc450a0857d1"><div class="ttname"><a href="namespaceShipCAD.html#a30b09a2ad6cc05c2ce1cdc450a0857d1">ShipCAD::PointProjectToLine</a></div><div class="ttdeci">QVector3D PointProjectToLine(const QVector3D &amp;p1, const QVector3D &amp;p2, const QVector3D &amp;p)</div><div class="ttdoc">project a point to a line </div><div class="ttdef"><b>Definition:</b> <a href="utility_8cpp_source.html#l00068">utility.cpp:68</a></div></div>
<div class="ttc" id="namespaceShipCAD_html_ad1ad66c896fe763fb4603989ff1f1182"><div class="ttname"><a href="namespaceShipCAD.html#ad1ad66c896fe763fb4603989ff1f1182">ShipCAD::MidPoint</a></div><div class="ttdeci">QVector3D MidPoint(const QVector3D &amp;p1, const QVector3D &amp;p2)</div><div class="ttdoc">get the midpoint between 2 points (interpolate 50%) </div><div class="ttdef"><b>Definition:</b> <a href="utility_8cpp_source.html#l00063">utility.cpp:63</a></div></div>
<div class="ttc" id="namespaceShipCAD_html_ac344c080c66b4394cb988cf88c726029"><div class="ttname"><a href="namespaceShipCAD.html#ac344c080c66b4394cb988cf88c726029">ShipCAD::DegToRad</a></div><div class="ttdeci">float DegToRad(float deg)</div><div class="ttdoc">convert degrees to radians </div><div class="ttdef"><b>Definition:</b> <a href="utility_8cpp_source.html#l00243">utility.cpp:243</a></div></div>
<div class="ttc" id="namespaceShipCAD_html_a646812cc2b9066dfc47f2ed7e1faa955"><div class="ttname"><a href="namespaceShipCAD.html#a646812cc2b9066dfc47f2ed7e1faa955">ShipCAD::Truncate</a></div><div class="ttdeci">QString Truncate(float val, int max_length)</div><div class="ttdoc">convert a float value to a string with max number of decimals </div><div class="ttdef"><b>Definition:</b> <a href="utility_8cpp_source.html#l00224">utility.cpp:224</a></div></div>
<div class="ttc" id="namespaceShipCAD_html_af88f847dc1803cadbeb655783961dbfd"><div class="ttname"><a href="namespaceShipCAD.html#af88f847dc1803cadbeb655783961dbfd">ShipCAD::RotateVector</a></div><div class="ttdeci">QVector3D RotateVector(const QVector3D &amp;coord, double sinx, double cosx, double siny, double cosy, double sinz, double cosz)</div><div class="ttdoc">rotate a vector </div><div class="ttdef"><b>Definition:</b> <a href="utility_8cpp_source.html#l00645">utility.cpp:645</a></div></div>
<div class="ttc" id="namespaceShipCAD_html_aa5d3fc63603d716d3e24244049e1e510"><div class="ttname"><a href="namespaceShipCAD.html#aa5d3fc63603d716d3e24244049e1e510">ShipCAD::MinMax</a></div><div class="ttdeci">void MinMax(const QVector3D &amp;p, QVector3D &amp;min, QVector3D &amp;max)</div><div class="ttdoc">find the min and max coordinates from a point </div><div class="ttdef"><b>Definition:</b> <a href="utility_8cpp_source.html#l00040">utility.cpp:40</a></div></div>
<div class="ttc" id="namespaceShipCAD_html_a696bc38864a736dda734802f3cda4346"><div class="ttname"><a href="namespaceShipCAD.html#a696bc38864a736dda734802f3cda4346">ShipCAD::ReadFloatFromStr</a></div><div class="ttdeci">float ReadFloatFromStr(size_t lineno, const QString &amp;str, size_t &amp;start)</div><div class="ttdoc">convert a string to an float value </div><div class="ttdef"><b>Definition:</b> <a href="utility_8cpp_source.html#l00534">utility.cpp:534</a></div></div>
<div class="ttc" id="namespaceShipCAD_html_acb142056788b7a6e18e908c5b2fd8d52"><div class="ttname"><a href="namespaceShipCAD.html#acb142056788b7a6e18e908c5b2fd8d52">ShipCAD::FillColor</a></div><div class="ttdeci">QColor FillColor(float parameter)</div><div class="ttdoc">calculate color on basis of wavelength (0.0 - 1.0) </div><div class="ttdef"><b>Definition:</b> <a href="utility_8cpp_source.html#l00160">utility.cpp:160</a></div></div>
<div class="ttc" id="namespaceShipCAD_html_a2eddf75f0e29363ab81a3fb0e0211848"><div class="ttname"><a href="namespaceShipCAD.html#a2eddf75f0e29363ab81a3fb0e0211848">ShipCAD::JoinSplineSegments</a></div><div class="ttdeci">void JoinSplineSegments(float join_error, bool force_to_one_segment, SplineVector &amp;list)</div><div class="ttdoc">join a set of linesegments and connect them into as few as possible splines </div><div class="ttdef"><b>Definition:</b> <a href="utility_8cpp_source.html#l00428">utility.cpp:428</a></div></div>
<div class="ttc" id="namespaceShipCAD_html_ae416df4a72579eb3a1a418b19551eb53"><div class="ttname"><a href="namespaceShipCAD.html#ae416df4a72579eb3a1a418b19551eb53">ShipCAD::ChangeFileExt</a></div><div class="ttdeci">QString ChangeFileExt(const QString &amp;name, const QString &amp;ext)</div><div class="ttdoc">Append or change the file extension to that given. </div><div class="ttdef"><b>Definition:</b> <a href="utility_8cpp_source.html#l00569">utility.cpp:569</a></div></div>
<div class="ttc" id="namespaceShipCAD_html_aec056383a39d900bd079feee8bcca060"><div class="ttname"><a href="namespaceShipCAD.html#aec056383a39d900bd079feee8bcca060">ShipCAD::Lines3DIntersect</a></div><div class="ttdeci">bool Lines3DIntersect(const QVector3D &amp;p1, const QVector3D &amp;p2, const QVector3D &amp;p3, const QVector3D &amp;p4, double &amp;param, QVector3D &amp;int1)</div><div class="ttdoc">Calculate the line segment PaPb that is the shortest route between two lines P1P2 and P3P4...</div><div class="ttdef"><b>Definition:</b> <a href="utility_8cpp_source.html#l00375">utility.cpp:375</a></div></div>
<div class="ttc" id="namespaceShipCAD_html_ae1b7d6603b6c5a2969befdbd629f2e8b"><div class="ttname"><a href="namespaceShipCAD.html#ae1b7d6603b6c5a2969befdbd629f2e8b">ShipCAD::FuzzyCompare</a></div><div class="ttdeci">bool FuzzyCompare(float val1, float val2, float error)</div><div class="ttdoc">compare 2 floats, if they are sufficiently close, return true </div><div class="ttdef"><b>Definition:</b> <a href="utility_8cpp_source.html#l00616">utility.cpp:616</a></div></div>
<div class="ttc" id="namespaceShipCAD_html_ac24d97adcdf1709fc8e857f5d07395ff"><div class="ttname"><a href="namespaceShipCAD.html#ac24d97adcdf1709fc8e857f5d07395ff">ShipCAD::ConvertDimension</a></div><div class="ttdeci">QString ConvertDimension(float value, unit_type_t units)</div><div class="ttdoc">create a string holding a dimension based on project units </div><div class="ttdef"><b>Definition:</b> <a href="utility_8cpp_source.html#l00664">utility.cpp:664</a></div></div>
<div class="ttc" id="namespaceShipCAD_html_a87efc267ae07a84fb1cd55a4562c2907"><div class="ttname"><a href="namespaceShipCAD.html#a87efc267ae07a84fb1cd55a4562c2907">ShipCAD::FindDXFColorIndex</a></div><div class="ttdeci">int FindDXFColorIndex(QColor color)</div><div class="ttdoc">convert a QColor to a DXF color index </div><div class="ttdef"><b>Definition:</b> <a href="utility_8cpp_source.html#l00133">utility.cpp:133</a></div></div>
<div class="ttc" id="namespaceShipCAD_html_a44025ef38e6ee9f12cbf032660f637b5"><div class="ttname"><a href="namespaceShipCAD.html#a44025ef38e6ee9f12cbf032660f637b5">ShipCAD::FindWaterViscosity</a></div><div class="ttdeci">float FindWaterViscosity(float density, unit_type_t units)</div><div class="ttdoc">find water viscosity based on density </div><div class="ttdef"><b>Definition:</b> <a href="utility_8cpp_source.html#l00555">utility.cpp:555</a></div></div>
<div class="ttc" id="namespaceShipCAD_html_ae378a523725f5718c9f2b55103f08dcb"><div class="ttname"><a href="namespaceShipCAD.html#ae378a523725f5718c9f2b55103f08dcb">ShipCAD::MakeLength</a></div><div class="ttdeci">QString MakeLength(float value, int decimals, int des_length)</div><div class="ttdoc">Create a formatted string from a float value. </div><div class="ttdef"><b>Definition:</b> <a href="utility_8cpp_source.html#l00603">utility.cpp:603</a></div></div>
<div class="ttc" id="namespaceShipCAD_html_a053b941b2c87049bb9380428d4d5a056"><div class="ttname"><a href="namespaceShipCAD.html#a053b941b2c87049bb9380428d4d5a056">ShipCAD::SplineVector</a></div><div class="ttdeci">PointerVector&lt; Spline &gt; SplineVector</div><div class="ttdef"><b>Definition:</b> <a href="spline_8h_source.html#l00186">spline.h:186</a></div></div>
<div class="ttc" id="namespaceShipCAD_html_a70b238d926183460670b82d9680b5cb9"><div class="ttname"><a href="namespaceShipCAD.html#a70b238d926183460670b82d9680b5cb9">ShipCAD::ReadIntFromStr</a></div><div class="ttdeci">int ReadIntFromStr(size_t lineno, const QString &amp;str, size_t &amp;start)</div><div class="ttdoc">convert a string to an integer value </div><div class="ttdef"><b>Definition:</b> <a href="utility_8cpp_source.html#l00497">utility.cpp:497</a></div></div>
<div class="ttc" id="namespaceShipCAD_html_a36b9b33181823761bc327d66c36c8d8f"><div class="ttname"><a href="namespaceShipCAD.html#a36b9b33181823761bc327d66c36c8d8f">ShipCAD::ClipTriangle</a></div><div class="ttdeci">void ClipTriangle(const QVector3D &amp;p1, const QVector3D &amp;p2, const QVector3D &amp;p3, float s1, float s2, float s3, std::vector&lt; QVector3D &gt; &amp;front, std::vector&lt; QVector3D &gt; &amp;back)</div><div class="ttdoc">clip a triangle given vertex point distances from a plane </div><div class="ttdef"><b>Definition:</b> <a href="utility_8cpp_source.html#l00280">utility.cpp:280</a></div></div>
<div class="ttc" id="namespaceShipCAD_html_ad3ca198e79658bf065f1c1c416f23670"><div class="ttname"><a href="namespaceShipCAD.html#ad3ca198e79658bf065f1c1c416f23670">ShipCAD::VolumeToDisplacement</a></div><div class="ttdeci">float VolumeToDisplacement(float volume, float density, float appcoeff, unit_type_t units)</div><div class="ttdoc">convert volume to displacement given density, appendage coefficient and unit type ...</div><div class="ttdef"><b>Definition:</b> <a href="utility_8cpp_source.html#l00581">utility.cpp:581</a></div></div>
<div class="ttc" id="namespaceShipCAD_html"><div class="ttname"><a href="namespaceShipCAD.html">ShipCAD</a></div><div class="ttdef"><b>Definition:</b> <a href="backgroundimage_8h_source.html#l00039">backgroundimage.h:39</a></div></div>
<div class="ttc" id="namespaceShipCAD_html_a438e97b711c6878eba3bf7182e68a3c7"><div class="ttname"><a href="namespaceShipCAD.html#a438e97b711c6878eba3bf7182e68a3c7">ShipCAD::DistPP3D</a></div><div class="ttdeci">float DistPP3D(const QVector3D &amp;p1, const QVector3D &amp;p2)</div><div class="ttdoc">distance between 2 3D points </div><div class="ttdef"><b>Definition:</b> <a href="utility_8cpp_source.html#l00369">utility.cpp:369</a></div></div>
<div class="ttc" id="namespaceShipCAD_html_a69361fa79b1f818e21306f6266ee45d3"><div class="ttname"><a href="namespaceShipCAD.html#a69361fa79b1f818e21306f6266ee45d3">ShipCAD::DistancepointToLine</a></div><div class="ttdeci">float DistancepointToLine(const QVector3D &amp;p, const QVector3D &amp;l1, const QVector3D &amp;l2)</div><div class="ttdoc">find the distance from a point to the line </div><div class="ttdef"><b>Definition:</b> <a href="utility_8cpp_source.html#l00050">utility.cpp:50</a></div></div>
<div class="ttc" id="namespaceShipCAD_html_a26237f4689cbf7e356c7c1ce3f9c69ff"><div class="ttname"><a href="namespaceShipCAD.html#a26237f4689cbf7e356c7c1ce3f9c69ff">ShipCAD::to_size_t</a></div><div class="ttdeci">size_t to_size_t(int val)</div><div class="ttdoc">convert an int to a size_t </div><div class="ttdef"><b>Definition:</b> <a href="utility_8cpp_source.html#l00630">utility.cpp:630</a></div></div>
<div class="ttc" id="namespaceShipCAD_html_a6f9f5ac15e7e2821bba27ba06827a4e1"><div class="ttname"><a href="namespaceShipCAD.html#a6f9f5ac15e7e2821bba27ba06827a4e1">ShipCAD::SquaredDistPP</a></div><div class="ttdeci">float SquaredDistPP(const QVector3D &amp;p1, const QVector3D &amp;p2)</div><div class="ttdoc">squared distance between 2 3D points </div><div class="ttdef"><b>Definition:</b> <a href="utility_8cpp_source.html#l00363">utility.cpp:363</a></div></div>
<div class="ttc" id="namespaceShipCAD_html_ae1773f0e415446342401a67430a8b643"><div class="ttname"><a href="namespaceShipCAD.html#ae1773f0e415446342401a67430a8b643">ShipCAD::PointInTriangle</a></div><div class="ttdeci">bool PointInTriangle(const QVector3D &amp;intercept, const QVector3D &amp;p0, const QVector3D &amp;p1, const QVector3D &amp;p2)</div><div class="ttdoc">find if point lies inside a triangle and on the plane of the triangle </div><div class="ttdef"><b>Definition:</b> <a href="utility_8cpp_source.html#l00269">utility.cpp:269</a></div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Sun Feb 25 2018 15:36:00 for ShipCAD by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.11
</small></address>
</body>
</html>
